﻿// ## 2023/11/28 # 铃 # 黑神优化特技算法后,把255的防御逻辑放在这里,作为单独的防御指令AI,255的仅作为最后手段 ##
// ## 2023/10/27 # 铃 # 重构 ##

namespace 据点防御
{

    //=======================================================================================
    bool 调试模式 = false;
    bool 调试模式2 = false;
    bool 调试模式3 = false;

    class Main
    {

        Main()
        {
            pk::bind(202, pk::trigger202_t(onAIRunningOrder));

        }
        array<bool> arr_base_defence(据点_末, false);
        pk::list<pk::unit @> list_enemy_unit;
        pk::point base_pos;
        //pk::list<pk::person @> except_person_list;

        //---------------------------------------------------------------------------------------

        //******************************************调度前判决**************************************
        void onAIRunningOrder(pk::ai_context @context, pk::building @building, int cmd)
        {
            if (cmd == 据点AI_据点迎击)
            {
                func_base_defence(building);
            }
            return;
        }

        void func_base_defence(pk::building @base)
        {
            //pk::info(pk::format("前置据点防御打印时间: {}", pk::decode(pk::get_name(base))));

            if (enemy_unit_around(base))
            {
                if (调试模式2) pk::info(pk::format("3据点防御通过验证: {}", pk::decode(pk::get_name(base))));


                if (base.troops < 10000) return;

                pk::list<pk::person @> person_list = pk::get_idle_person_list(base);

                if (person_list.count == 0)
                    return;


            // 武将排序，优先考虑特技，按统率+武力排序。
                person_list.sort(function(a, b) {
                    int a_score = a.stat[武将能力_武力] * UNIT_ATTR::攻武占比 + a.stat[武将能力_统率] * UNIT_ATTR::攻统占比 * 2 + a.stat[武将能力_智力] * UNIT_ATTR::防智占比;
                    int b_score = b.stat[武将能力_武力] * UNIT_ATTR::攻武占比 + b.stat[武将能力_统率] * UNIT_ATTR::攻统占比 * 2 + b.stat[武将能力_智力] * UNIT_ATTR::防智占比;
                    // 考虑武将能力
                    return (a_score > b_score);
                });


                for (int push_count = 0; push_count < pk::min(10, person_list.count); push_count++)
                {
                    PushCoveringUnit(base, person_list[push_count]);

                }
            }


        }

        bool PushCoveringUnit(pk::building @src_base, pk::person @person)
        {
           // pk::info(pk::format("排序之前: {}", pk::decode(pk::get_name(src_base))));
            main.base_pos = src_base.pos;

            auto time = pk::get_tick_count();
              // 武将排序，优先考虑特技，按统率+武力排序。
            list_enemy_unit.sort(function(a, b) {

                //优先攻击最近的部队
                int a_score = -pk::get_distance(a.pos, main.base_pos);
                int b_score = -pk::get_distance(b.pos, main.base_pos);

                //一格以内的木兽最优先
                if ((a.weapon == 兵器_冲车 or a.weapon == 兵器_木兽) and pk::get_distance(a.pos, main.base_pos) == 1) a_score += 3;
                if ((b.weapon == 兵器_冲车 or b.weapon == 兵器_木兽) and pk::get_distance(b.pos, main.base_pos) == 1) b_score += 3;

                //优先攻击兵器
                if (a.weapon == 兵器_冲车 or a.weapon == 兵器_井阑 or a.weapon == 兵器_木兽 or a.weapon == 兵器_投石) a_score += 3;
                if (b.weapon == 兵器_冲车 or b.weapon == 兵器_井阑 or b.weapon == 兵器_木兽 or b.weapon == 兵器_投石) b_score += 3;

                //骑兵威胁小,不需要优先打骑兵
                if (a.weapon == 兵器_战马) a_score -= 2;
                if (a.weapon == 兵器_战马) a_score -= 2;

                //没空位就不去
                if (!pk::is_valid_pos(main.get_empty_pos(a.pos, 1, 1))) a_score -= 5;
                if (!pk::is_valid_pos(main.get_empty_pos(b.pos, 1, 1))) b_score -= 5;


                return (a_score > b_score);
            });

            auto time2 = pk::get_tick_count();
            if (调试模式3 and time2 - time > 20) pk::trace("list_enemy_unit:" + (time2 - time));
            // 设置攻击目标部队
            pk::unit @target = list_enemy_unit[0];

            //pk::info(pk::format("排序之后: {}", pk::decode(pk::get_name(src_base))));

            if (target is null) return false;

            int unit_id = push_unit(src_base, target, person, true);
            auto time3 = pk::get_tick_count();
            if (调试模式3 and time3 - time2 > 20) pk::trace("push_unit:" + (time3 - time2));
            if (unit_id != -1)
                return true;

            return false;
        }

        bool enemy_unit_around(pk::building @building)
        {
            if (!pk::is_alive(building))
                return false;

            list_enemy_unit.clear();
            int enemy_troops = 0;

            if (调试模式2) pk::info(pk::format("0据点防御: {}", pk::decode(pk::get_name(building))));

            pk::list<pk::unit @> unit_list = pk::get_unit_list();
            for (int i = 0; i < unit_list.count; i++)
            {
                pk::unit @unit = unit_list[i];
                if (!pk::is_alive(unit))
                    continue;

                //  跳过非普通类型部队
                if (unit.type == 部队类型_运输)
                    continue;

                //不去防御走栈道的部队
                pk::hex@ hex = pk::get_hex(unit.pos);
                if (hex.terrain == 地形_栈道)
                    continue;

                //不在境内的不用管
                if (pk::get_building_id(unit.pos) != building.get_id())
                    continue;

                //不在境内的不用管
                if (!pk::is_enemy(unit, building))
                    continue;

                    //这个判断优先级很高.这个之后还会有一些AI专用的剔除
                    // 境内或者距离内发现玩家单位则需要强制迎击.
                if (unit.is_player() and pk::get_building_id(unit.pos) == building.get_id() and unit.troops >= 1000)
                {
                    list_enemy_unit.add(unit);
                    enemy_troops += unit.troops;
                }

                //距离太近的敌人
                else if (pk::get_distance(building.pos, unit.pos) < 5)
                {
                    list_enemy_unit.add(unit);
                    enemy_troops += unit.troops;
                }



                //正在攻击据点,而且据点为己方据点(建筑)
                else if (unit.target_type == 部队任务对象_据点 and pk::is_valid_building_id(unit.target) and pk::get_building(unit.target).get_force_id() == building.get_force_id())
                {
                    if (pk::get_building_id(pk::get_building(unit.target).pos) == building.get_id() and unit.troops >= 1000)
                    {
                        list_enemy_unit.add(unit);
                        enemy_troops += unit.troops;
                    }
                }


                else if (pk::is_valid_pos(unit.target_pos))
                {
                // 如果正在攻击己方建筑,且建筑距离比较近.则出兵防御
                    @hex = pk::get_hex(unit.target_pos);
                    if (hex.has_building)
                    {
                        pk::building @target_building = pk::get_building(unit.target_pos);
                        if (target_building.get_force_id() == building.get_force_id() and (pk::get_building_id(target_building.pos) == building.get_id() or pk::get_building_id(unit.pos) == building.get_id()))
                        {
                            list_enemy_unit.add(unit);
                            enemy_troops += unit.troops;
                        }
                    }

                    // 如果正在攻击己方部队,且部队距离比较近.则出兵防御
                    if (hex.has_unit)
                    {
                        pk::unit @target_unit = pk::get_unit(unit.target_pos);
                        if (target_unit.get_force_id() == building.get_force_id() and (pk::get_building_id(target_unit.pos) == building.get_id() or pk::get_building_id(unit.pos) == building.get_id()))
                        {
                            list_enemy_unit.add(unit);
                            enemy_troops += unit.troops;
                        }
                    }
                }
            }

           // pk::info(pk::format("寻找部队后: {}", pk::decode(pk::get_name(building))));

            int count = pk::get_idle_person_list(building).count;

            if (调试模式2) pk::info(pk::format("1据点防御,count:{};list_enemy_unit:{},enemy_troops{}", count, list_enemy_unit.count, enemy_troops));

            //如果己方兵力强大,则直接迎击.
            if (count > 0 and list_enemy_unit.count > 0 and pk::get_troops(building) > 25000 and (int(pk::get_troops(building)) > int(enemy_troops * 0.8) or pk::get_troops(building) > 35000))
                return true;

            //如果己方兵力较为紧张,则等到敌军靠近再迎击(大城6距离,小城5距离).
            if (count > 0 and list_enemy_unit.count > 0 and pk::get_troops(building) > 20000 and (int(pk::get_troops(building)) > int(enemy_troops * 0.6) or pk::get_troops(building) > 20000) and ai::base_around_enemy_troops[building.get_id()] > 0)
                return true;

            //如果己方非常紧张,则等到敌军兵临城下再迎击
            if (count > 0 and list_enemy_unit.count > 0 and pk::get_troops(building) > 13000 and pk::enemies_around(building))
                return true;

            return false;
        }

        int push_unit(pk::building @src_base, pk::unit @target, pk::person @person, bool do_cmd = true)
        {
            //pk::info(pk::format("push_unit开始: {}", pk::decode(pk::get_name(src_base))));
            if (调试模式2) pk::info(pk::format("4据点防御push_unit: {}", pk::decode(pk::get_name(src_base))));

            int src_troops = pk::get_troops(src_base);
            if (src_troops <= 11000)
                return -1; // 兵力不足

            if (调试模式2) pk::info(pk::format("5据点防御push_unit: {}", pk::decode(pk::get_name(src_base))));

            int reinforce_troops = pk::min(20000, pk::get_command(person), int(pk::get_troops(src_base) - 6000));

            if (reinforce_troops < 5000) return -1;


            // 选择最佳的武器
            int ground_weapon_id = 兵器_剑;
            int ground_weapon_score = 0;
            int water_weapon_id = 兵器_走舸;
            int unit_troops = reinforce_troops;

            //*******************  陆地兵器  ******************
            // 选择陆上武器
            ground_weapon_id = get_ground_weapon(src_base, person, 1).first;
            ground_weapon_score = get_ground_weapon(src_base, person, 1).second;

            //pk::trace(pk::decode(pk::get_name(leader)) + get_weapon_name(ground_weapon_id) + "ground_weapon_id" + ground_weapon_id + "ground_weapon_score:" + ground_weapon_score + ",unit_troops :" + unit_troops);

            //如果没有合适的武器,就把他放到移除列表
            if (ground_weapon_score == 0 or ground_weapon_id == 0)
            {
                //except_person_list.add(person);
                return -1;
            }

            if (调试模式2) pk::info(pk::format("8据点防御push_unit: {}", pk::decode(pk::get_name(src_base))));

            if (ground_weapon_id <= 兵器_战马)
            {
                unit_troops = pk::min(unit_troops, pk::get_weapon_amount(src_base, ground_weapon_id));

            }

            if (unit_troops < 5000) return -1;

            if (调试模式2) pk::info(pk::format("9据点防御push_unit: {}", pk::decode(pk::get_name(src_base))));

            //********************  水上兵器  ***********************
            water_weapon_id = 兵器_走舸;

        //**********************  新粮草计算  **********************
        // 使用新的unit_distance计算部队消耗
        // 最终带粮基准值为路上*2+15回合战斗
            int base_weight = 5;

            if (pk::get_food(src_base) > pk::get_troops(src_base) * 5 and pk::get_food(src_base) > 80000)
                base_weight += 1;

            float rate = (base_weight * 2 + 15);
            if ((ground_weapon_id > 兵器_战马 and ground_weapon_id < 兵器_走舸) or ground_weapon_id == 兵器_戟) // 跑得慢的多加一些
                rate *= 1.25f;

            rate = pk::min(rate, 35.0); // 无论如何都不会超过350天,防止带的太多影响城市粮草
            int unit_food = int(unit_troops * rate / 10);
            if (unit_food > int(pk::get_food(src_base) * 0.5))
                return -1;

            if (do_cmd)
            {
                // 创建出征指令信息
                pk::com_march_cmd_info cmd;
                @cmd.base = @src_base;
                cmd.type = 部队类型_战斗;
                cmd.member[0] = person.get_id();
                cmd.gold = (pk::get_gold(src_base) >= 1000) ? int(pk::min(1000.f, pk::get_gold(src_base) * 0.1f)) : 0;
                cmd.troops = pk::max(1, unit_troops);
                cmd.weapon_id[0] = ground_weapon_id;
                cmd.weapon_id[1] = water_weapon_id;
                cmd.weapon_amount[0] = (is_siege_weapon(ground_weapon_id)) ? 1 : pk::max(1, unit_troops);
                cmd.weapon_amount[1] = (water_weapon_id == 兵器_走舸) ? 0 : 1;
                cmd.food = pk::min(50000, unit_food);

                cmd.order = 部队任务_攻击;
                cmd.target_pos = target.pos; // 设置目标

               // ai出征优化::main.march_modify(cmd, 0/*0防御，1攻击，2建设，3运输*/);

                if (cmd.weapon_id[0] == -1)
                    return -1;

                //pk::info(pk::format("据点防御优化_出征部队_:部队: {},兵装{},兵力{},兵装数量{},城市此兵装数量{}", pk::decode(pk::get_name(person_list[0])), cmd.weapon_id[0], cmd.troops, cmd.weapon_amount[0], pk::get_weapon_amount(src_base, cmd.weapon_id[0])));

                int unit_id = pk::command(cmd);

               // pk::info(pk::format("据点优化结果:部队:{},兵力:{},兵装:{},兵装数量:{},目标:{},任务:{},", pk::decode(pk::get_name(person_list[0])), cmd.troops, cmd.weapon_id[0], cmd.weapon_amount[0], cmd.target_pos.x, cmd.order));

                //执行出征指令

                if (unit_id == -1)
                    return -1;

                pk::unit @unit_cmd = pk::get_unit(unit_id);
                if (pk::is_alive(unit_cmd))
                {
                    unit_cmd.action_done = true; // 设置部队行动完成

                    if (调试模式)
                    {
                        string src_name = pk::decode(pk::get_name(src_base));
                        string unit_name = pk::decode(pk::get_name(pk::get_person(unit_cmd.leader)));
                        string weapon_name = get_weapon_name(unit_cmd.weapon);
                        pk::person @target_p = pk::get_person(target.leader);
                        string target_name = (pk::is_alive(target_p)) ? pk::decode(pk::get_name(target_p)) : "";
                        string order_str = get_order_info(unit_cmd.order);
                        pk::info(pk::format("据点防御:部队: {}({},weapon_id{}), {} 从({},{})向{}攻击", unit_name, weapon_name, unit_cmd.weapon, src_name, unit_cmd.pos.x, unit_cmd.pos.y, target_name));

                    }

                    return unit_id;
                }
            }

            return -1;
        }

        //******************************************* 攻城工具判断   ****************************************************************
        bool is_siege_weapon(int weapon_id)
        {
            if (兵器_冲车 <= weapon_id and weapon_id <= 兵器_木兽)
                return true;
            return false;
        }

        //******************************************* 武器选择函数   ****************************************************************
        pk::int_int get_ground_weapon(pk::building @base, pk::person @leader, int type)
        {
            array<int> heishu_score(兵器_末, 0);    // 适性评分，是否可以参考副将补全
            array<bool> can_march(兵器_末, false);  // 是否有足够兵器可出征
            array<int> tech_score(兵器_末, 0);      // 已研究科技评分
            array<int> ling_score(兵器_末, 0);      // 根据态势调整
            array<int> skill_score(兵器_末, 0); // 总特技评分
            array<int> all_score(兵器_末, 0);       // 兵器和适性的总评分

            pk::force @force0 = pk::get_force(leader.get_force_id());
            for (int i = 0; i < 兵器_走舸; i++)
            {

                can_march[i] = true;
                if (leader.tekisei[pk::equipment_id_to_heishu(i)] < 适性_B)
                {
                    can_march[i] = false;
                }
                if ((i == 兵器_冲车 or i == 兵器_木兽) and !enemy_building_around(base))// 冲车木兽不在防御时出动
                {
                    can_march[i] = false;
                }

                if ((i == 兵器_冲车 or i == 兵器_木兽 or i == 兵器_井阑 or i == 兵器_投石) and leader.tekisei[pk::equipment_id_to_heishu(i)] < 适性_S)//野战部队除非有S兵器,否则不出兵器
                {
                    can_march[i] = false;
                }
                if (!ch::check_weapon_able(base, i))
                {
                    can_march[i] = false;
                }
                if (can_march[i])
                {
                    if (i == 兵器_战马)  ling_score[i] += 5; //防御支援的时候,一定是野战条件,这时候骑兵优势最大
                    if (i == 兵器_枪)  ling_score[i] += 3; //防御支援的时候,一定是野战条件,这时候枪兵攻击高有优势
                    if (i == 兵器_戟)  ling_score[i] += 2; //防御支援的时候,一定是野战条件,这时候戟兵也很适合
                    if (i == 兵器_弩 and ch::is_gate(base.get_id()))ling_score[i] += 3; //关隘防守是弩兵优先
                    if (i > 兵器_战马)  ling_score[i] -= 3; //防御支援的时候,井阑移动速度过慢,很不适合作为防御支援,除非不得已或者只适合井阑.
                    if ((i == 兵器_冲车 or i == 兵器_木兽 or i == 兵器_井阑 or i == 兵器_投石)) ling_score[i] -= 5;

                    if (i == 兵器_剑)  heishu_score[i] = 0;
                    else heishu_score[i] = leader.tekisei[pk::equipment_id_to_heishu(i)];
                    tech_score[i] = ch::get_tech_score(force0, i);

                    int skill_id = leader.skill;
                    if (skill_id < 211 and skill_id >-1)
                    {
                        //pk::trace(pk::decode(pk::get_name(leader)) + get_weapon_name(i) + "i:" + i + "skill_id :" + skill_id);
                        skill_score[i] = ai出征优化::skill_score[skill_id][i];
                    }
                    all_score[i] = heishu_score[i] * 3 + tech_score[i] + skill_score[i] + ling_score[i];

                   //pk::trace(pk::decode(pk::get_name(leader)) + get_weapon_name(i) + "科技分:" + tech_score[i] + "特技分:" + skill_score[i] + ",适性分:" + heishu_score[i] * 3 + ",态势分:" + ling_score[i] + ",总分:" + all_score[i]);

                }
            }

            return pk::int_int(get_arr_max(all_score));
        }

        pk::int_int get_arr_max(array<int> score)
        {
            int best_score = 0;
            int id = 0;
            for (int i = 0; i < int(score.length); i++)
            {
                if (score[i] > best_score)
                {
                    best_score = score[i];
                    id = i;
                }
            }

            return pk::int_int(id, best_score);
        }

        //---------------------------------------------------------------------------------------

        bool check_can_defense(pk::building @building)
        {
            // 如果兵力不足,不要出城太远去迎击,只能等触发城下迎击逻辑
            int 总兵装 = pk::get_weapon_amount(building, 1) + pk::get_weapon_amount(building, 2) + pk::get_weapon_amount(building, 3) + pk::get_weapon_amount(building, 4);
            if (总兵装 < 10000 or pk::get_troops(building) < 8000 or pk::get_food(building) < 10000)
                return false;

            pk::list<pk::unit @> unit_list = pk::get_unit_list();
            for (int i = 0; i < unit_list.count; i++)
            {
                pk::unit @unit = unit_list[i];
                if (!pk::is_alive(unit))
                    continue;

                //  跳过玩家部队及非普通类型部队
                if (unit.type == 部队类型_运输)
                    continue;

                // 大城市在自己境内且距离太近强制迎击
                if (pk::get_building_id(unit.pos) == building.get_id() and building.get_id() < 城市_末 and pk::get_distance(building.pos, unit.pos) < ((building.get_id() < 城市_末) ? 10 : 5))
                    return true;

                // 境内或者距离内发现玩家单位则需要迎击.
                if (unit.is_player() and pk::get_building_id(unit.pos) == building.get_id())
                    return true;

                // 自己境内,或者距离自己太近的部队(如果距离比较近,只要指向自己就需要迎击,只是小城市迎击距离更近一些)
                if (pk::get_building_id(unit.pos) == building.get_id() or pk::get_distance(building.pos, unit.pos) < ((building.get_id() < 城市_末) ? 6 : 3))
                {
                    if ((unit.order == 部队任务_征服 or unit.order == 部队任务_攻城) and pk::is_valid_base_id(unit.target))
                    {
                        if (pk::is_valid_base_id(unit.target) and unit.target == building.get_id())
                            return true;
                    }
                }

                // if (pk::is_valid_pos(unit.target_pos))
                // {
                // 	// 如果正在攻击己方建筑,且建筑距离比较近.则出兵防御
                // 	pk::hex @hex = pk::get_hex(unit.target_pos);
                // 	if (hex.has_building)
                // 	{
                // 		pk::building @target_building = pk::get_building(unit.target_pos);
                // 		if (target_building.get_force_id() == building.get_force_id() and (pk::get_distance(building.pos, unit.pos) < 15 and pk::get_building_id(unit.pos) == building.get_id()))
                // 			return true;
                // 	}

                // 	// 如果正在攻击己方部队,且部队距离比较近.则出兵防御
                // 	if (hex.has_unit)
                // 	{
                // 		pk::unit @target_unit = pk::get_unit(unit.target_pos);
                // 		if (target_unit.get_force_id() == building.get_force_id() and (pk::get_distance(building.pos, unit.pos) < 15 and pk::get_building_id(unit.pos) == building.get_id()))
                // 			return true;
                // 	}
                // }
            }
            return false;
        }

        bool enemy_building_around(pk::building @building)
        {
            pk::list<pk::building @> list_enemy_building;
            list_enemy_building.clear();

            pk::list<pk::building @> building_list = pk::get_building_list();
            for (int i = 0; i < building_list.count; i++)
            {
                pk::building @building0 = building_list[i];
                int force0_id = pk::get_building_id(building0.pos);
                int facility_id = building0.facility;

                if (!pk::is_alive(building0))
                    continue;
                if (!pk::is_enemy(building, building0))
                    continue;

                if (facility_id >= 设施_火种 or facility_id == 设施_土垒 or facility_id == 设施_石壁 or facility_id <= 设施_港口)
                    continue;
                if (building.get_id() != pk::get_building_id(building0.pos))
                    continue;
                if (building0.get_force_id() == building.get_force_id())
                    continue;
                int spec_id = ch::to_spec_id(building0.get_id());

                if (pk::get_distance(building0.pos, building.pos) >= 6)
                    continue;

                list_enemy_building.add(building0);
            }

            if (list_enemy_building.count > 0)
                return true;

            return false;
        }

        pk::point get_empty_pos(pk::point pos, int distance_min, int distance_max)
        {
            array<pk::point> range_pos_arr = pk::range(pos, distance_min, distance_max);

            for (int arr_index = 0; arr_index < int(range_pos_arr.length); arr_index++)
            {
                pk::point range_pos = range_pos_arr[arr_index];
                if (!pk::is_valid_pos(range_pos))
                    continue;

                pk::hex @hex = pk::get_hex(range_pos);
                if (hex.has_building)
                    continue;
                if (hex.has_unit)
                    continue;

                int terrain_id = hex.terrain;
                if (!pk::is_valid_terrain_id(terrain_id))
                    continue;
                if (!pk::is_enabled_terrain(terrain_id))
                    continue;

                return range_pos;
            }

            return pk::point(-1, -1);
        }

        //=======================================================================================

        string get_weapon_name(int weapon_id)
        {
            string weapon_name;
            switch (weapon_id)
            {
                case 兵器_剑:
                    weapon_name = "剑兵";
                    break;
                case 兵器_枪:
                    weapon_name = "枪兵";
                    break;
                case 兵器_戟:
                    weapon_name = "戟兵";
                    break;
                case 兵器_弩:
                    weapon_name = "弩兵";
                    break;
                case 兵器_战马:
                    weapon_name = "骑兵";
                    break;
                case 兵器_冲车:
                    weapon_name = "冲车";
                    break;
                case 兵器_井阑:
                    weapon_name = "井阑";
                    break;
                case 兵器_投石:
                    weapon_name = "投石";
                    break;
                case 兵器_木兽:
                    weapon_name = "木兽";
                    break;
                case 兵器_走舸:
                    weapon_name = "水军";
                    break;
                case 兵器_楼船:
                    weapon_name = "水军";
                    break;
                case 兵器_斗舰:
                    weapon_name = "水军";
                    break;
                default:
                    weapon_name = "??";
                    break;
            }
            return weapon_name;
        }

        string get_order_info(int order)
        {
            string name;
            switch (order)
            {
                case 0:
                    name = "部队任务_待命";
                    break;
                case 1:
                    name = "部队任务_移动";
                    break;
                case 2:
                    name = "部队任务_设置";
                    break;
                case 3:
                    name = "部队任务_攻击";
                    break;
                case 4:
                    name = "部队任务_撤退";
                    break;
                case 5:
                    name = "部队任务_拦截";
                    break;
                case 6:
                    name = "部队任务_护卫";
                    break;
                case 7:
                    name = "部队任务_攻城";
                    break;
                case 8:
                    name = "部队任务_修复";
                    break;
                case 9:
                    name = "部队任务_征服";
                    break;
                case 10:
                    name = "部队任务_补给";
                    break;
                case 11:
                    name = "部队任务_歼灭";
                    break;
                case 12:
                    name = "部队任务_追随";
                    break;
                case 13:
                    name = "部队任务_末";
                    break;
                default:
                    name = "部队任务_没有";
                    break;
            }

            return name;
        }

    };
    Main main;
}